﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SysRouteLinq
{
    public partial class CadastrarEmpresa : Form
    {
        public CadastrarEmpresa()
        {
            InitializeComponent();
        }

        private SysRouteDataContext dc = new SysRouteDataContext();

        private void button1_Click(object sender, EventArgs e)
        {
            {
                Empresa emp = new Empresa
                {
                    nome = textBox2.Text,
                    CNPJ = textBox3.Text,
                    endereco = textBox4.Text,
                    telefone = textBox5.Text,
                };
                dc.Empresas.InsertOnSubmit(emp);
                dc.SubmitChanges();

                MessageBox.Show("Cadastro Realizado com sucesso");

                textBox2.Clear();
                textBox3.Clear();
                textBox4.Clear();
                textBox5.Clear();
            }
        }
        

        private void button2_Click(object sender, EventArgs e)
        {
           this.Close();
        }


    }

}